package com.sa.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sa.user.dataobject.UserPoints;
import org.apache.ibatis.annotations.Select;

/**
 * @Entity com.sa.user.dataobject.UserPoints
 */
public interface UserPointsMapper extends BaseMapper<UserPoints> {

    // 通过user_id查询用户积分
    @Select("SELECT * FROM user_points WHERE user_id = #{userId}")
    public UserPoints getUserPointsByUserId(Integer userId);

    // 通过user_id扣减5积分
    @Select("UPDATE user_points SET points = points - 5 WHERE user_id = #{userId}")
    public void deductUserPoints(Integer userId);

}




